#pragma once

#ifndef TIANDITU_SELECT_H
#define TIANDITU_SELECT_H

#include <iostream>
#include <string>
#include "utility.h"
#include "nlohmann/json.hpp"

struct Lnglat
{
    double lng;
    double lat;
};

struct TileIndex
{
    int x;
    int y;
};

enum class TileMode
{
    ZYX,
    ZXY
};

class TianDiTuSelector
{
public:
    TianDiTuSelector(const std::string& openDir, const std::string& saveDir, int level, TileMode tileMode);

    ~TianDiTuSelector() = default;

    void move(const std::string& regName);

private:
    Extent getExtent(const std::string& regName);
    TileIndex lnglatToTileIndex(Lnglat lnglat);
    std::string moveTile(TileIndex xy);

    Regin _dataSource;
    std::string _openDir;
    std::string _saveDir;
    int _level;
    TileMode _tileMode;
    Extent _extent;
};

#endif // TIANDITU_SELECT_H